#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#define BUFFER_SIZE 100
#define BUFFER_SIZE2 11

int main()
{
    int array[BUFFER_SIZE];
        /*生成随机数的种子*/
        srand(time(NULL));
    for(int idx = 0; idx < BUFFER_SIZE; idx++)
    {

        array[idx] = rand() % 10 + 1;

    }

    int array2[BUFFER_SIZE2];
    memset(array2, 0, sizeof(array2));//消除脏数
    

    for(int idx = 0; idx < BUFFER_SIZE; idx++)
    {
        switch (array[idx])
        {
        case 1:
            array2[1]++;
            break;
        case 2:
            array2[2]++;
            break;
        case 3:
            array2[3]++;
            break;
        case 4:
            array2[4]++;
            break;
        case 5:
            array2[5]++;
            break;
        case 6:
            array2[6]++;
            break;
        case 7:
            array2[7]++;
            break;
        case 8:
            array2[8]++;
            break;
        case 9:
            array2[9]++;
            break;
        case 10:
            array2[10]++;
            break;

        default:
            break;
        }
    }

    int max_num = array2[1];
    int sub = 1;
    for(int idx = 2; idx < BUFFER_SIZE2; idx++)
    {
        if(array2[idx] > max_num)
        {
            max_num = array2[idx];
            sub = idx;
        }
    }
    printf("%d\n",sub);
    printf("%d\n",max_num);


    /*作业：100个数,范围在1-10，个数出现的次数最多*/

}
